Encoding apparatus, encoding method, and storage medium

ABSTRACT

In an encoding apparatus or an encoding method, motion-image data is input, an encoding parameter is output such that a predetermined number of codes are used for encoding the input motion-image data in units of predetermined sizes, the output encoding parameter is stored in a storage medium, and the input motion-image data is encoded by adaptively selecting the output encoding parameter or the encoding parameter stored in the storage medium.

BACKGROUND OF THE INVENTION

1. Field of the Invention

The present invention relates to encoding apparatuses and encodingmethods suited to encode a digital motion image input from a camera orother device, and also relates to storage media for storing an encodingprogram for encoding a digital motion image.

2. Description of the Related Art

In a conventional technology, to encode a motion image with the mostsuitable number of codes at a uniform image quality, tentative encodingis performed first to estimate a suitable number of codes, and then thenumber of codes estimated in the tentative encoding is used for a nextencoding. With this method, a large number of codes can be assigned to aframe which requires a large number of codes, and the number of codescan be reduced for a frame which does not require a large number ofcodes.

When an image sent from a camera is encoded in real time, there hasconventionally been only one method in which a target number of codes isspecified for each set of a plurality of frames, a next target number ofcodes is re-specified by the use of an encoding capacity and the firsttarget number of codes, and the number of codes is set to a constantrate within the set of the plurality of frames.

In the conventional method employing tentative encoding, since encodingis required twice, the method takes twice the amount of time to beperformed as compared to that required in conventional encodingtechniques, which perform encoding only once.

Moreover, in the conventional method specifying the target number ofcodes, since the number of codes is set to a constant rate within theset of the plurality of frames, when the input image moves fast or acolor band is broad, quantization becomes coarse. As a result, an imagehaving non-uniform frames may be generated. Also, when the input imagemoves slow, or when a color band is narrow, an undesirably extra numberof codes is often used.

SUMMARY OF THE INVENTION

Accordingly, it is an object of the present invention to provide anencoding apparatus and an encoding method which allow a motion image tobe encoded in real time with the most suitable number of codes whichproduce a uniform image quality, and to provide a storage medium forstoring an encoding program which achieves the above processing.

The foregoing object is achieved in one aspect of the present inventionthrough the provision of an image encoding apparatus including inputmeans for inputting motion-image data; control means for outputting anencoding parameter such that a predetermined number of codes are usedfor encoding the input motion-image data in units of predeterminedsizes; storage means for storing the encoding parameter output by thecontrol means; and encoding means for encoding the motion-image datainput from the input means by adaptively selecting the encodingparameter output from the control means or the encoding parameter storedin the storage means.

The foregoing object is achieved in another aspect of the presentinvention through the provision of an image encoding method includingthe steps of inputting motion-image data; outputting an encodingparameter such that a predetermined number of codes are used forencoding the input motion-image data in units of predetermined sizes;storing the output encoding parameter in a storage medium; and encodingthe input motion-image data by adaptively selecting the output encodingparameter or the encoding parameter stored in the storage medium.

The foregoing object is achieved in still another aspect of the presentinvention through the provision of a storage medium for storing aprogram. The program includes computer-readable code for performing amethod comprising the steps of (a) inputting motion-image data; (b)outputting an encoding parameter such that a predetermined number ofcodes are used for encoding the input motion-image data in units ofpredetermined sizes; (c) storing the output encoding parameter; and (d)encoding the input motion-image data by adaptively selecting either theencoding parameter output in the outputting step or the encodingparameter stored in the storing step.

Other objects, features and advantages of the present invention willbecome apparent from the following detailed description taken inconjunction with the accompanying drawings.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram of an image encoding apparatus according to afirst embodiment of the present invention.

FIG. 2, consisting of FIGS. 2A and 2B, is a view showing exemplarydefault quantization matrixes used in intra-encoding and inter-encodingoperations performed in this invention.

FIG. 3 is a block diagram of an image encoding apparatus according to asecond embodiment of the present invention.

FIG. 4 is a block diagram of an image encoding apparatus according to athird embodiment of the present invention.

FIG. 5 is a block diagram of an image encoding apparatus according to afourth embodiment of the present invention.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

The various embodiments of the present invention will be described belowwith reference to the drawings.

First Embodiment

FIG. 1 shows a block diagram of an image encoding apparatus according toa first embodiment of the present invention.

In FIG. 1, the image encoding apparatus comprises a video camera 100 foroutputting image data, an input terminal 101 for inputting the imagedata output from the video camera 100, a buffer 102, a switch 103, anintra/inter selection circuit 103A, a subtraction circuit 104, a DirectCosine Transform (DCT) circuit 105, a quantization circuit 106, avariable-length encoding circuit 107, an inverse quantization circuit108, and an Indirect Cosine Transform (IDCT) circuit 109. The imageencoding apparatus also comprises an adder 110, a motion-compensationprediction circuit 111, a switch 112, a buffer 113, a rate controlcircuit 114, a switch 115, a quantization memory 116, an output terminal117, and a recording circuit 128 for recording data output from theoutput terminal 117 onto a recording medium.

In the present embodiment, encoding processing conforming to the MPEG-1or MPEG-2 standard is executed by the variable-length encoding circuit107. Therefore, two types of encoding modes, such as an intra-encodingmode and an inter-encoding mode, are preferably used in the presentembodiment. Data included in individual frames is used for encodingduring the intra-encoding mode, whereas prediction between frames isused for encoding in the inter-encoding mode.

A frame in which all data is intra-encoded is hereinafter referred to asan I picture, and a frame which can be prediction-encoded using apreceding frame is hereinafter referred to as a P picture.Intra-encoding may be used for a small block (such as a DCT block) inthe P picture. A frame which can be prediction-encoded by the use ofpreceding and subsequent frames is hereinafter referred to as a Bpicture. Intra-encoding may be used for a small block (such as a DCTblock) in the B picture in the same way as for the P picture. I picturesgenerally appear every predetermined number of frames, and picturesranging from an I picture to those appearing immediately before a next Ipicture are hereinafter referred to as a group of pictures (GOP).

One sequence of motion images are divided into GOPs and encoded. Forexample, the sequence may include pictures I, B, B, P, B, B, P, B, B, P,B, B, P, B, B, I, etc.

Component encoding is applied to one picture, in which the picturesignal is divided into a luminance (Y) signal and two color difference(Cb and Cr) signals and encoded. The Cb and Cr signals are sub-sampledhorizontally and vertically at a rate which is half of that for the Ysignal.

A block formed of eight by eight pixels is preferably used as theminimum encoding unit. DCT is applied in units of blocks. A combinationof four adjacent Y-signal blocks, one Cb block, and one Cr blockpositionally corresponding thereto (totalling six blocks) is referred toas a macroblock (MB), wherein a plurality of macroblocks form a slice,and a picture is formed of slices. The macroblock preferably serves as aminimum unit for motion-compensation prediction. A motion vector isdetected in units of macroblocks in motion-compensation prediction.Macroblocks are divided into four types, namely (1) an intra MB,obtained by directly applying DCT to an original signal, (2) a forwardMB, obtained by prediction, using a preceding MB only, (3) backward MB,obtained by prediction, using a subsequent MB only, and (4) abi-predictive MB, obtained by predicting in both directions. An Ipicture is encoded using only intra MBs. A P picture is encoded byselecting either an intra MB or a forward MB. B pictures are encoded byselecting one of the above-mentioned four MBs.

The operation of the image encoding apparatus shown in FIG. 1 will nowbe described, separately for I-picture encoding and for P- and B-pictureencodings.

In I-picture encoding and P- and B-picture encodings, image data outputfrom the video camera 100 is input to the input terminal 101 and storedin the buffer 102.

When an I picture is to be encoded, as determined by A the circuit 103Abased on signals applied thereto, the switch 103 is switched to terminalA by that circuit 103A. As a result, the image data output from thebuffer 102 is input to the DCT circuit 105 through the switch 103, andis orthogonally transformed in the DCT circuit 105. The orthogonallytransformed image data is then quantized by the quantization circuit106, and resulting quantized image data is then input to both theinverse quantization circuit 108 and the variable-length encodingcircuit 107. The image data which is output from the buffer 102 also isprovided to the motion-compensation prediction circuit 111, as can beappreciated in view of FIG. 1.

Within the inverse quantization circuit 108, the quantized data isinverse-quantized by that circuit 108, and is then forwarded to the IDCTcircuit 109 wherein the data is then inverse-DCTed to provide IDCT imagedata. The IDCT image data is then input to the motion-compensationprediction circuit 111 through the adder 110 (switch 112 is open in thiscase), and the motion-compensation prediction circuit 111 then outputs aprediction image for a next inter-encoding.

Referring now to the variable-length encoding circuit 107, after thequantized data is received by that circuit 107 from the circuit 106, thequantized data is variable-length-encoded by the variable-lengthencoding circuit 107, and is then input to the buffer 113 for storagetherein. Then the image data is output through the output terminal 117and is recorded on a recording medium by the recording circuit 128.

When a P- or B-picture is to be encoded, as determined by the circuit103A based on signals applied thereto, the switch 103 is controlled soas to be connected to terminal B. The prediction image output from themotion-compensation prediction circuit 111 is subtracted from the imagedata output from the buffer 102 in the subtraction circuit 104. Thissubtraction circuit 104 is provided in order to reduce redundancy in thetime-axis direction.

The image data in which redundancy has been reduced in the time-axisdirection by the subtraction circuit 104 is then input to the DCTcircuit 105 and is orthogonally transformed therein. The orthogonallytransformed image data is then provided to the quantization circuit 106wherein it is quantized and then provided to the inverse quantizationcircuit 108 and the variable-length encoding circuit 107. The image dataoutput from the buffer 102 also is input to the motion-compensationprediction circuit 111.

Within the inverse quantization circuit 108, the quantized data isinverse-quantized by the inverse quantization circuit 108, and then isIDCTed by the IDCT circuit 109. The resulting IDCT image data is theninput to the motion-compensation prediction circuit 111 through theadder 110 when the switch 112 is open. When the switch 112 is closed,the IDCT image data is added to the prediction image output from themotion-compensation prediction circuit 111 by the adder 110 to form adecoded image. This decoded image is then input to themotion-compensation prediction circuit 111 for the next image encoding.The motion-compensation prediction circuit 111 outputs a predictionimage for the next inter-encoding, and also outputs a motion vector. Themotion vector is input to the variable-length encoding circuit 107.

Two quantization methods will be described next, which are features ofthe present embodiment.

The description is made for the first N (N≦1) GOPs of data after thestart of encoding.

The switch 115 is controlled by controller (not shown) as follows. Whenencoding is started, the switch 115 is connected to terminal A. Toperform encoding at a nearly constant rate in one GOP, the rate controlcircuit 114 controls the encoding rate.

In this rate control, the target number of codes is specified for eachof an I picture, a P picture, and a B picture in advance before encodingthe GOPs. The target number of codes is stored in the circuit 114. Whenthe encoded data is input to the buffer 113, the rate control circuit114 monitors the number of codes of the encoded image input to thebuffer 113. When it is determined that the monitored number of codesequals the target number of codes, or is less than that target number ofcodes, quantization is performed based on predetermined defaultquantization characteristics, such as predetermined default quantizationcoefficients.

FIGS. 2A and 2B each show an example of a matrix of default quantizationcoefficients, although it should be noted that coefficients other thanthose shown in FIGS. 2A and 2B also may be employed. The defaultquantization coefficients are stored in circuit 114, prior to being usedto quantize the data in circuit 106.

When the monitored number of codes is determined by the circuit 114 tobe larger than the target number of codes, quantization is performedwithin the circuit 106, based on larger quantization coefficients beinglarger than the default quantization coefficients. The largerquantization coefficients are one from a plurality of sets ofcoefficients stored in the circuit 114. The smaller the quantizationcoefficients are (the finer the quantization steps are), the lower thecompression rate is and the less the image-quality deterioration is. Thelarger the quantization coefficients are (the coarser the quantizationsteps are), the higher the compression rate is and the more theimage-quality deterioration is.

When encoding is performed at a constant rate in units of GOPs with theuse of the rate control circuit 114, the quantization coefficients usedin the quantization circuit 106 are stored in the quantization memory116. The quantization memory 116 is provided for each of theintra-encoding mode and the inter-encoding mode. It is switchedaccording to the encoding mode. The quantization coefficients isselectively input/output from the memory 116, based on whether theinter-encoding mode or intra-encoding mode being implemented.

After N GOPs are encoded, the switch 115 is switched to terminal B.Frame quantization is performed by selecting the most appropriatequantization coefficients (those used before) from the quantizationmemory 116. In other words, the stored quantization coefficients (thoseused in the preceding frame) are read from the quantization memory 116according to the encoding mode selected by the intra/inter selectioncircuit 103A, and quantization is performed by circuit 106 using theread quantization coefficients.

The selection of the intra-encoding mode or inter-encoding mode will nowbe described. The intra/inter selection circuit 103A selects eitherintra-encoding mode or the inter-encoding mode.

The intra/inter selection circuit 103A compares the amount of data sentfrom the buffer 102 with the amount of data sent from the subtractioncircuit 104, and selects whichever amount is smaller. When it isdetermined that the amount of data from the buffer 102 is smaller, theswitch 103 is switched to terminal A, and thus the intra-encoding modeis selected. When it is determined that the amount of data from thesubtraction circuit 104 is smaller, the switch 103 is switched toterminal B, and thus the inter-encoding mode is selected.

The switch 112 is either opened or closed according to the selection ofthe encoding mode in the intra/inter selection circuit 103A. Morespecifically, when the intra/inter selection circuit 103A selects theintra-encoding mode, the switch 112 is controlled so as to be placed inan open position. When the inter-encoding mode is selected, on the otherhand, the switch 112 is controlled so as to be placed in a closedposition.

The intra/inter selection circuit 103A also controls the selection ofthe quantization characteristic (coefficients) stored in thequantization memory 116. The intra/inter selection circuit 103A controlsthe switches 103 and 112 such that the intra-encoding mode is set inunits of a predetermined number of frames.

With the above method and apparatus, a motion image having a uniformimage quality can be encoded in real time.

Second Embodiment

FIG. 3 is a block diagram of an image encoding apparatus according to asecond embodiment of the present invention. In FIG. 3, the same symbolsas those used in FIG. 1 are assigned to components which operate in thesame manner as those shown in FIG. 1, and thus further descriptionsthereof will be omitted.

In FIG. 3, an image comparison circuit 118 is added to the structureshown in FIG. 1.

The operation of the image encoding apparatus shown in FIG. 3 will nowbe described.

Image data output from a video camera 100 is input to an input terminal101, and then is sent to a buffer 102 and to the image comparisoncircuit 118. The image comparison circuit 118 holds the image in thepreceding frame, and compares the luminance signal and the colordifference signals between the current frame and the preceding frame. Ifit is determined in the comparison that the current frame issubstantially different from the preceding frame (i.e., values of theluminance and color difference signals from the current and precedingframes differ by at least a respective predetermined threshold value),the switch 115 is switched to side A by the circuit 118, andquantization-coefficient control is performed by rate control circuit114.

The output signal of the image comparison circuit 118 is also input toan intra/inter selection circuit 103A′. When the output signal indicatesthat the current frame is substantially different than the precedingframe, the switch 103 is connected to side A by the circuit 103A′ inorder to execute intra-encoding, and the switch 112 is controlled so asto be placed in an open position to start a new GOP.

With the above operation, since the quantization characteristic of thepreceding frame is not used for a completely different image,image-quality deterioration is prevented.

Since encoding in the apparatus of FIG. 3 is performed in the samemanner as in the first embodiment, a detailed description thereof willbe omitted herein.

Third Embodiment

FIG. 4 is a block diagram of an image encoding apparatus according to athird embodiment of the present invention. In FIG. 4, the same symbolsas those used in FIG. 1 are assigned to components which operate in thesame manner as those shown in FIG. 1, and further detailed descriptionsthereof will be omitted. In the present embodiment, the presentinvention is applied to a video camera, and the elements shown in FIG. 4are included in the camera (not shown) although in other embodiments,those elements may be included in an external device associated with thecamera.

In FIG. 4, a lens 119, a CCD 120 serving as a capturing device, acamera-signal processing circuit 121, a gyroscope circuit 122 whichoperates in a known manner by outputting a signal in response to amovement of the camera, and an A-D converter 123, are added to thestructure shown in FIG. 1.

The operation of the image encoding apparatus shown in FIG. 4 will nowbe described.

In both I-picture encoding and in P- and B-picture encoding, an imageinput from the lens 119 is converted to a digital signal in the CCD 120,and then is input to the camera-signal processing circuit 121. Thecamera-signal processing circuit 121 performs a calculation based uponinformation received from the CCD 120 and gyroscope circuit 122 by wayof the A-D circuit 122, to determine a degree and direction of movementof the camera, and performs a calculation based upon the determineddegree and direction of movement of the camera to determine acompensation value. The circuit 121 also corrects the image datareceived from CCD by using the compensation value and outputs thecorrected image data to the buffer 102.

According to the method described in the first embodiment, a motionimage having a uniform image quality is encoded in real time. When acamera is used for capturing an image, if a large movement occurs in thecamera as a result of, for example, shaking in the hands of anoperation, or a quick panning is performed, a whole screen is greatlychanged.

In the present embodiment, when the camera-signal processing circuit 121determines that most of the screen has changed, by recognizing that thedegree of movement of the camera exceeds a predetermined thresholddegree, switch 115 controlled by circuit 121 so as to be connected toterminal A, and the number-of-codes control is executed in theabove-described manner to perform encoding at a nearly constant ratewithin one GOP. After N GOPs are encoded, the switch 115 is switched toterminal B. Frame quantization is performed by selecting thequantization coefficients (those used before) from the quantizationmemory 116.

In the present embodiment, when the camera-signal processing circuit 121determines that most of the screen has been changed, the result of thedetermination is also input to the intra/inter selection circuit 103A″.When encoding of an I picture or a P picture is finished, the switch 103is controlled by the circuit 103A″ so as to be connected to terminal A,and the switch 112 is controlled by the circuit 103A″ so as to be placedin an open position to start a new GOP.

Since the operation of encoding in the present embodiment is the same asthat in the first embodiment, a detailed description thereof will beomitted herein.

Fourth Embodiment

FIG. 5 is a block diagram of an image encoding apparatus according to afourth embodiment of the present invention. In FIG. 5, the same symbolsas those used in FIG. 4 are assigned to components which operate in thesame manner as those shown in FIG. 4, and detailed descriptions thereofwill be omitted.

In FIG. 5, a microcomputer 124 is used instead of the gyroscope circuit122 and the A-D converter 123 used in FIG. 4. The microcomputer 124controls various camera-related functions, including, for example,change in an iris of the camera and a zooming (lens focal length) of thecamera, and outputs information indicating those changes, as well asinformation representing light levels perceived by the camera.

The operation of the image encoding apparatus shown in FIG. 5 will nowbe described.

The camera-signal processing circuit 121 determines a compensation valueby performing a calculation using an input digital image signal, andoutputs image data in the same way as in the third embodiment.

In addition, in the present embodiment, the camera-signal processingcircuit 121 calculates a change of white balance (light intensitylevel), a change of the iris, and a change of zooming (lens focallength) according to information sent from the microcomputer 124. Whenit is determined that white balance has changed, the iris has changed,or zooming has changed, by more than a corresponding predeterminedthreshold value, the switch 115 is controlled so as to be switched toterminal A thereof, and encoding is performed at a nearly constant ratewithin one GOP. After N GOPs are encoded, the switch 115 is switched toterminal B. Frame quantization is performed by selecting thequantization coefficients (those used before) from the quantizationmemory 116.

In the present embodiment, when it is determined that white balance haschanged, the iris has changed, or zooming has changed, by more than acorresponding predetermined threshold value, the result of thedetermination is also input to an intra/inter selection circuit 103A″′.When encoding of an I picture or a P picture is finished, the switch 103is controlled so as to be connected to terminal A thereof, and theswitch 112 is controlled so as to be placed in an open position to starta new GOP.

Since the operation of encoding in the present embodiment is the same asthat in the first embodiment, a detailed description thereof will beomitted.

Other Embodiments

A storage medium according to other embodiments of the present inventionwill be described next.

Each of the embodiments shown in FIG. 1, FIG. 3, FIG. 4, and FIG. 5 canbe configured by hardware. It can also be configured by a computersystem having a CPU and a memory. When the computer system is used, thememory serves as a storage medium according to the present invention.The storage medium stores a program for executing the operationdescribed in each of the above embodiments.

The storage medium can be, for example, a semiconductor memory, such asa ROM or a RAM, an optical disk, a magneto-optical disk, or amagnetic-recording medium. The storage medium can be used as a CD-ROM, afloppy disk, a magnetic card, magnetic tape, or a non-volatile memorycard.

Therefore, when the storage medium is used in a system other than thoseshown in FIG. 1, FIG. 3, FIG. 4, and FIG. 5, or a computer, and thesystem or the computer reads a program code stored in the storage mediumand executes it, the same functions as those implemented in the aboveembodiments are provided, the same advantages are obtained, and theobject of the present invention is achieved.

Furthermore, the same functions as those implemented in the aboveembodiments are provided, the same advantages are obtained, and theobject of the present invention is achieved, when the operating systemrunning on the computer performs part or all of the above-describedprocessing operations, or when the program code read from the storagemedium is written into a memory provided for an extension function boardinserted into the computer or an extension function unit connected tothe computer, and the CPU provided for the extension function board orthe extension function unit performs part or all of the above-describedprocessing operations.

As described above, according to the above embodiments, a motion imageis encoded in real time at a uniform image quality with the mostappropriate number of codes.

Since encoding is performed only once unlike conventional methodsemploying tentative encoding, the processing time is reduced.

In the conventional method in which the target number of codes isspecified, if an input image has a fast motion or if a color band isbroad, quantization becomes coarse. This drawback is solved by thepresent invention.

In other words, the foregoing description of embodiments has been givenfor illustrative purposes only, and is not to be construed as beinglimited only to the specific examples described above.

The scope of the invention is, therefore, to be determined solely by thefollowing claims, and is not necessarily limited by the text of thespecifications, and alterations made within a scope equivalent to thescope of the claims fall within the true spirit and scope of theinvention.

1. An image encoding apparatus, comprising: an input device forinputting motion-image data; a quantizer for quantizing the inputtedmotion-image data, based on quantization coefficient information appliedto an input of said quantizer; an encoder for encoding image dataquantized by said quantizer to output corresponding encoded image dataincluding a number of codes; a rate control circuit for determiningwhether or not the number of codes included in the encoded image dataexceeds a predetermined threshold value, and for outputting a selectedone of a plurality of first sets of quantization coefficients, based ona result of that determination; a memory storing a plurality of secondsets of quantization coefficients; and a selector for selecting eitherthe first set of quantization coefficients output by said rate controlcircuit or one of the second sets of quantization coefficients stored insaid memory, and applying the selected set of quantization coefficientsto the input of said quantizer, to cause said quantizer to quantize theinputted motion-image data, based on that selected set of quantizationcoefficients.
 2. An image encoding apparatus according to claim 1,wherein, for a predetermined number of frames of the inputtedmotion-image data, said selector selects the set of first-quantizationcoefficients output by said rate control circuit, and applies thatselected set of first quantization coefficients to the input of saidquantizer, to enable said quantizer to quantize the inputtedmotion-image data based on that set of first quantization coefficients,and wherein for subsequent frames of the inputted motion-image data,said selector selects one of the sets of second quantizationcoefficients and applies that selected set of second quantizationcoefficients to the input of said quantizer, to enable said quantizer toquantize the inputted motion-image data based on that selected set ofsecond quantization coefficients.
 3. An image encoding apparatusaccording to claim 1, further comprising a detector for detecting achange in adjacent frames included in the inputted motion-image data,wherein said selector selects either the set of first quantizationcoefficients output by said rate control circuit or one of the sets ofsecond quantization coefficients stored in said memory, based on anoutput of said detector.
 4. An image encoding apparatus according toclaim 3, wherein said input device comprises an image capturer forcapturing images that are in view of the image capturer to input themotion-image data, and said detector detects the change in the adjacentframes included in the inputted motion-image data based on an output ofsaid image capturer.
 5. An image encoding apparatus according to claim3, wherein said encoder encodes the image data quantized by saidquantizer according to either an inter-encoding technique or anintra-encoding technique, depending on a selection made by saidselector.
 6. An image encoding apparatus according to claim 5, whereinsaid selector selects the set of first quantization coefficients for apredetermined number of frames of the inputted motion-image data, tocause said encoder to encode the image data quantized by said quantizeraccording to the intra-encoding technique.
 7. An image encodingapparatus according to claim 1, further comprising a detector fordetecting at least one of a change of a white balance in the inputtedmotion-image data, a change in an iris, and a zooming change, whereinsaid selector selects either the set of first quantization coefficientsoutput by said rate control circuit or one of the sets of secondquantization coefficients stored in said memory, based on an output ofsaid detector.
 8. An image encoding apparatus according to claim 1,further comprising a recorder for recording the encoded image output bysaid encoder.
 9. An image encoding apparatus according to claim 1,wherein said encoder encodes the image data quantized by said quantizerin accordance with at least one of the MPEG-1 standard and the MPEG-2standard.
 10. A method for encoding motion-image data, comprising thesteps of: inputting motion-image data; providing a set of quantizationcoefficients to a first input of a quantizer; applying the inputtedmotion-image data to a second input of the quantizer to cause thequantizer to quantize the inputted motion-image data based on the set ofquantization coefficients provided to the first input of the quantizer,and outputting resulting quantized image data; encoding image dataquantized by the quantizer to provide encoded image data including anumber of codes; determining whether or not the number of codes includedin the encoded image data exceeds a predetermined threshold value, andselecting one of a plurality of provided sets of first quantizationcoefficients, based on a result of that determination; and selectingeither the selected one of the provided sets of first quantizationcoefficients or one of a plurality of provided sets of secondquantization coefficients, and applying that selected set ofquantization coefficients to the first input of the quantizer to causethe quantizer to quantize the inputted motion-image data based on thatselected set of quantization coefficients.
 11. A storage medium storinga program having computer-readable code for executing a method forencoding motion-image data, the method comprising the steps of:inputting motion-image data; providing a set of quantizationcoefficients to a first input of a quantizer; applying the inputtedmotion-image data to a second input of the quantizer to cause thequantizer to quantize the inputted motion-image data based on the set ofquantization coefficients provided to the first input of the quantizer,and outputting resulting quantized image data; encoding image dataquantized by the quantizer to provide encoded image data including anumber of codes; determining whether or not the number of codes includedin the encoded image data exceeds a predetermined threshold value, andselecting one of a plurality of provided sets of first quantizationcoefficients, based on a result of that determination; and selectingeither the selected one of the provided sets of first quantizationcoefficients or one of a plurality of provided sets of secondquantization coefficients, and applying that selected set ofquantization coefficients to the first input of the quantizer to causethe quantizer to quantize the inputted motion-image data based on thatselected set of quantization coefficients.